package com.sax.answer.main;

import java.io.IOException;
import java.util.List;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;

import com.sax.answer.dao.WeiBoDAO;
import com.sax.answer.dao.impl.WeiBoDaoImpl;
import com.sax.answer.entity.WeiBo;
import com.sax.answer.handler.WeiBoHandler;

public class Main {

	public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
		// TODO Auto-generated method stub

		SAXParserFactory parperFactory=SAXParserFactory.newInstance();
		SAXParser parper=parperFactory.newSAXParser();
		WeiBoHandler weiBoHandler=new WeiBoHandler();
		parper.parse("weibodata.xml", weiBoHandler);
		List<WeiBo> list=weiBoHandler.getWeiBoList();
		WeiBoDAO dao=new WeiBoDaoImpl();
		dao.insert(list);
	}

}
